<if condition="$ischild neq 1">
<include file="Public:head" />
<else />
<include file="Repast:head" />
</if>
<script src="{pigcms:$staticPath}/tpl/static/artDialog/jquery.artDialog.js?skin=default"></script>
<script src="{pigcms:$staticPath}/tpl/static/artDialog/plugins/iframeTools.js"></script>
<script>
	$(function(){
		$("form").submit(function () {
			var keyword = $("#keyword").val();
			var wxpic = $("#wxpic").val();
			var name = $("#name").val();
			var price = $("#price").val();
			var type = $("#type").val();
			var logopic = $("#logopic").val();
			var fistpic = $("#fistpic").val();
			if(keyword == ''){
				alert('请填写关键字');
				buterror("#keyword");
				return false;
			}else if(wxpic == ''){
				alert('请添加活动图片');
				buterror("#wxpic");
				return false;
			}else if(name == ''){
				alert('请填写活动名称');
				buterror("#name");
				return false;
			}else if(price == '' || price == 0){
				alert('请填写商品价格');
				buterror("#price");
				return false;
			}else if(price < 2){
				alert('价格至少为2元');
				buterror("#price");
				return false;
			}else if(type == 0){
				alert('请选择商品分类');
				buterror("#type");
				return false;
			}else if(logopic == ''){
				alert('请添加商品logo图片');
				buterror("#logopic");
				return false;
			}else if(fistpic == ''){
				alert('请添加商品展示图片1');
				buterror("#fistpic");
				return false;
			}else{
				return true;
			}
		});
	});
	function buterror(id){
		$("html,body").animate({scrollTop: $("#ooo").offset().top}, 500);
		$(id).css("border","2px solid red");
		$(id).focus(function(){
			$(id).css("border","1px solid");
			$(id).css("border-color","#848484 #E0E0E0 #E0E0E0 #848484");
		})
	}
</script>
<form class="form" method="post"   action="{pigcms::U('Unitary/doupdate',array('token'=>$token))}" enctype="multipart/form-data" >
<input type="hidden" name="id" value="{pigcms:$unitary.id}"/>
<link rel="stylesheet" type="text/css" href="{pigcms:$staticPath}/tpl/static/unitary/css/cymain.css" />
<div class="content">
	<div class="cLineB" id="ooo">
		<h4 class="left">修改【{pigcms:$unitary.name}】</h4>
		<a href="{pigcms::U('Unitary/index',array('token'=>$token))}"  class="right btnGreen" >返回</a>
	</div>
	
	<div class="msgWrap bgfc">
		<table class="userinfoArea" style=" margin:0;" border="0" cellSpacing="0" cellPadding="0" width="100%">
			<tbody>
				<tr>
					<if condition="$_SESSION['is_syn'] eq 0">
					<th valign="top"><span class="red">*</span>关键词：</th>
					<td>
						<input type="input" class="px" id="keyword" value="{pigcms:$unitary.keyword}" name="keyword" style="width:400px" />
						<br/>
						<span class="red">只能写一个关键词</span>，用户输入此关键词将会触发此活动。
					</td>
					<else />
						<th valign="top"></th>
						<td><input type="hidden" class="px" id="keyword" value="<?php echo $_SESSION['is_syn'];?>" name="keyword" style="width:400px" /></td>
					</if>
					<td rowspan="999" valign="top">
						<div style="margin-left:20px">
							<?php if($unitary['wxpic'] == null){?>
							<img id="wxpic_src" src="{pigcms:$unitary.wxpic}" <if condition="$usertplid eq 2">style="min-width:300px;width:53%;"<else />width="373px"</if> />
							<?php }else{?>
							<img id="wxpic_src" src="{pigcms:$unitary.wxpic}" <if condition="$usertplid eq 2">style="min-width:300px;width:53%;"<else />width="373px"</if> />
							<?php }?>
							<br/>
							<input class="px"  name="wxpic" value="{pigcms:$unitary.wxpic}" id="wxpic" <if condition="$usertplid eq 2">style="min-width:275px;width: 50%;"<else />style="width:363px;"</if>  />
							<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('wxpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('wxpic')">预览</a>&nbsp;<span class="red"><strong>*</strong></span>微信图文信息图片，推荐尺寸：900*500
						</div>
					</td>
				</tr>
				<tr>
					<th valign="top"><span class="red">*</span>活动名称：</th>
					<td>
						<input type="input" class="px" id="name" value="{pigcms:$unitary.name}" name="name" style="width:400px" />
						<br/>
						请不要多于50字!
					</td>
				</tr>
				<tr>
					<th valign="top">微信中图文信息说明：</th>
					<td>
						<textarea  class="px" id="wxinfo" name="wxinfo"  style="width:400px; height:125px" >{pigcms:$unitary.wxinfo}</textarea>
						<br/>
						换行请输入
						&lt;br&gt;
					</td>
				</tr>
				<tr>
					<th valign="top"><span class="red">*</span>商品价格：</th>
					<td>
						<if condition="($pay_count eq 0) and ($unitary.state eq 0)">
						&#165;<input type="input" class="px" id="price" value="{pigcms:$unitary.price}" name="price" style="width:50px" />元
						<br/>
						不能有小数，活动开始后不能修改
						<else />
						&#165;{pigcms:$unitary.price}元
						<input type="hidden" class="px" id="price" value="{pigcms:$unitary.price}" name="price" style="width:50px" />
						</if>
					</td>
				</tr>
				<tr>
					<th valign="top"><span class="red">*</span>商品分类：</th>
					<td>
						<select name="type" id="type">
							<option value="0">--请选择分类--</option>
							<option value="1" <?php if($unitary['type'] == 1){echo "selected";}?>>手机数码</option>
							<option value="2" <?php if($unitary['type'] == 2){echo "selected";}?>>电脑办公</option>
							<option value="3" <?php if($unitary['type'] == 3){echo "selected";}?>>家用电器</option>
							<option value="4" <?php if($unitary['type'] == 4){echo "selected";}?>>化妆个护</option>
							<option value="5" <?php if($unitary['type'] == 5){echo "selected";}?>>钟表首饰</option>
							<option value="9999" <?php if($unitary['type'] == 9999){echo "selected";}?>>其他商品</option>
						</select>
					</td>
				</tr>
				<tr>
					<th valign="top"><span class="red">*</span>商品logo图片：</th>
					<td colspan="2">
						<input type="input" class="px" id="logopic"  name="logopic" value="{pigcms:$unitary.logopic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('logopic',400,400,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('logopic')">预览</a><br/><span class="red"><strong>*</strong></span>推荐尺寸：400*400
					</td>
				</tr>
				<tr>
					<th valign="top"><span class="red">*</span>商品展示图片1：</th>
					<td>
						<input type="input" class="px" id="fistpic"  name="fistpic" value="{pigcms:$unitary.fistpic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('fistpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('fistpic')">预览</a><br/><span class="red"><strong>*</strong></span>推荐尺寸：900*500
					</td>
				</tr>
				<tr>
					<th valign="top">商品展示图片2：</th>
					<td>
						<input type="input" class="px" id="secondpic"  name="secondpic" value="{pigcms:$unitary.secondpic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('secondpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('secondpic')">预览</a>
					</td>
				</tr>
				<tr>
					<th valign="top">商品展示图片3：</th>
					<td>
						<input type="input" class="px" id="thirdpic"  name="thirdpic" value="{pigcms:$unitary.thirdpic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('thirdpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('thirdpic')">预览</a>
					</td>
				</tr>
				<tr>
					<th valign="top">商品展示图片4：</th>
					<td>
						<input type="input" class="px" id="fourpic"  name="fourpic" value="{pigcms:$unitary.fourpic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('fourpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('fourpic')">预览</a>
					</td>
				</tr>
				<tr>
					<th valign="top">商品展示图片5：</th>
					<td>
						<input type="input" class="px" id="fivepic"  name="fivepic" value="{pigcms:$unitary.fivepic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('fivepic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('fivepic')">预览</a>
					</td>
				</tr>
				<tr>
					<th valign="top">商品展示图片6：</th>
					<td>
						<input type="input" class="px" id="sixpic"  name="sixpic" value="{pigcms:$unitary.sixpic}"  style="width:250px"/>
						<script src="{pigcms:$staticPath}/tpl/static/upyun.js"></script><a href="###" onclick="upyunPicUpload('sixpic',900,500,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('sixpic')">预览</a>
					</td>
				</tr>
				<tr>
					<th valign="top">结束倒计时：</th>
					<td> 
						<input type="input" class="px" id="min" value="{pigcms:$time_min}" name="min" style="width:30px" /> 分钟
						<br/>
						人数足够结束以后倒计时展示结果的时间，不填则不倒计时直接显示结果
					</td>
				</tr>
				<!-- <tr>
					<th valign="top">非关注用户：</th>
					<td><input class="radio" type="radio" name="wxregister" value="1" <?php if($unitary['wxregister'] == 1){echo "checked";}?>> 关注  <input class="radio" type="radio" name="wxregister" value="0"  <?php if($unitary['wxregister'] == 0){echo "checked";}?>> 注册 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（非关注用户参加活动的处理方式）
				</td>
				</tr>
				<tr>
					<th valign="top">无粉丝信息：</th>
					<td><input class="radio" type="radio" name="register" value="1" <?php if($unitary['register'] == 1){echo "checked";}?>> 注册  <input class="radio" type="radio" name="register" value="0"  <?php if($unitary['register'] == 0){echo "checked";}?>> 不注册 &nbsp;&nbsp;&nbsp;（没有粉丝信息参加活动的处理方式）</td>
				</tr> -->
				<!-- <tr>
					<th valign="top">商品活动状态：</th>
					<td><input class="radio" type="radio" name="state" value="1" <?php if($unitary['state'] == 1){echo "checked";}?>> 开始  <input class="radio" type="radio" name="state" value="0"  <?php if($unitary['state'] == 0){echo "checked";}?>> 关闭 </td>
				</tr> -->
				<tr>
					<th>&nbsp;</th>
					<td><button type="submit" class="btnGreen" >保存</button>　<a href="{pigcms::U('Unitary/index',array('token'=>$token))}"  class="btnGray vm">取消</a></td>
				</tr>
			</tbody>
		</table>
	</div>
	
</div>
</form>
<include file="Public:footer"/>